package ray.mgocc.title;

public class Sloth extends WeekTitle{

    public void init(){
        super.init();
        add(new HeadShotRecievedRequirement());
    }
    protected int getPlayTimeThreshold(){return 3;}
    public int getPriority(){ return 19; }

    class HeadShotRecievedRequirement extends Requirement{
        public String getName(){return "trap";}
        private double getHeadShotRatio(){
            double ratio;
            final String KEY = "Total.";
            int hs = getValue(KEY+"HS.DEATHS")+getValue(KEY+"HS.STUNS RECIEVED");
            int all = getValue(KEY+"ALL.DEATHS")+getValue(KEY+"ALL.STUNS RECIEVED");
            if(0==all){
                ratio = 0;
            }else{
                ratio = hs/all;
            }
            return ratio;
        }
        private double getThreshold(){
            return 0.35;
        }
        public double getRatio(){
            return getHeadShotRatio()/getThreshold();
        }
        public String toString(){
            return super.toString()+"("+format(getThreshold())+"<="+format(getHeadShotRatio())+")";
        }
    }

}

